#ifndef PROTOBUF_MSG_H
#define PROTOBUF_MSG_H

#include "NetWork/Packet.h"
#include "google/protobuf/message.h"

class MessageCallBack;
class Game_PacketFactory : public PacketFactory
{
public:
	virtual Packet* MallocPakcet();
	virtual void    FreePacket(Packet* pPacket);
	static Game_PacketFactory* GetInstance();
};

class PacketProto : public Packet
{
public:
	PacketProto();
	PacketProto(google::protobuf::Message* pMessage);
	~PacketProto();
	virtual int  GetSize();
	virtual bool write(SimpleBuf& pBuf);
	virtual bool read(SimpleBuf& pBuf,int nSize);
	virtual void process(void* extData);

	static google::protobuf::Message* CreateMessage(const std::string& name);

private:
	char m_szBuf[40960];
	std::string m_name;
	google::protobuf::Message* m_pMessage;
};
#endif